import { Router } from 'express';
import { NginxController } from '../controllers/nginx.controller';
import { auth } from '../middleware/auth';

const router = Router();

// 配置文件管理
router.get('/configs', auth, NginxController.getAllConfigs);
router.post('/configs', auth, NginxController.createConfig);
router.put('/configs/:filePath', auth, NginxController.updateConfig);
router.delete('/configs/:filePath', auth, NginxController.deleteConfig);

// Nginx 操作
router.post('/test', auth, NginxController.testConfig);
router.post('/reload', auth, NginxController.reloadConfig);

// 系统配置
router.get('/system-config', auth, NginxController.getSystemConfig);
router.post('/system-config', auth, NginxController.updateSystemConfig);
router.post('/test-exec', auth, NginxController.testNginxExec);
router.post('/test-conf-dir', auth, NginxController.testConfDir);
router.post('/test-docker', auth, NginxController.testDockerContainer);

router.get('/version', auth, NginxController.getNginxVersion);


export default router;